package com.situ.day1;
import java.util.Scanner;

import org.junit.Test;

public class Hello {
	
	public static void main(String[] args) {
		int num = 3;
		num = 23;
		System.out.println(num);
	}
	
	@Test
	public void test1() {
		int num1 = 34;
		int num2 = 45;
		boolean b = (num1 != num2); 
		System.out.println(b);
	}
	
	@Test
	public void test2() {
		int num1 = 65;
		int num2 = 300;
		boolean b = (num1 >= 60) && (num2 > 350);
		System.out.println(b);
	}
	
	@Test
	public void test3() {
		// 1、能被4整除，但是不能被100整除 &&
		// ||
		// 2、能被400整除
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入年份：");
		int year = scanner.nextInt();
		// if (() || ()) {}
		if ((year % 4 == 0 && year % 100 != 0) 
				|| (year % 400 == 0)) {
			System.out.println("是闰年");
		} else {
			System.out.println("不是闰年");
		}
	}
	
	@Test
	public void test44() {
		while (true) {
			// 1、编写一个收银台收款程序，if
			// 定义输入----单价、数量、金额
			// 定义输出----应收金额、找零
			// 使用double类型变量
			Scanner scanner = new Scanner(System.in);
			System.out.println("请输入单价：");
			double unitPrice = scanner.nextDouble();
			System.out.println("请输入数量：");
			int count = scanner.nextInt();
			double totalPrice = unitPrice * count;
			if (totalPrice >= 500) {
				totalPrice = totalPrice * 0.8;
				System.out.println("总价>=500时候打八折");
			}
			System.out.println("应付多少钱：" + totalPrice);
			System.out.println("用户付了多少钱：");
			double price = scanner.nextDouble();
			double returnPrice = price - totalPrice;
			if (returnPrice > 0) {
				System.out.println("应找零：" + returnPrice);
			} else if (returnPrice < 0) {
				System.out.println("给的钱不够");
			} else {
				System.out.println("钱正好");
			}
			
			System.out.println("您是否要退出：1退出");
			int quit = scanner.nextInt();
			if (quit == 1) {
				System.out.println("您已经退出");
				break;
			}
		}
	}
	
	
}
